package JavaSE.d3;

public class Test8 {
    public static void main(String[] args) {
        Son son = new Son();
        son.money(10000);
        if(son instanceof Son){
            System.out.println("我是儿子类的对象");
        }
        if(son instanceof Father){
            System.out.println("我的父类是Father");
        }
    }
}
class Father{
    private int count=100000;
    void money(){
        System.out.println("父亲：我有"+count+"元");
    }
}
class Son extends Father{
    private int count=5000000;
    void money(int count){
        System.out.println("儿子：我赚取了"+count+"元");//儿子数钱
        super.money();//调用super获取父类钱数
        this.count+=count;//this指儿子的钱
        System.out.println("儿子：我现在有"+this.count+"元");
    }
}